package com.rcw.commonlib;

import android.os.Build;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;

import com.rcw.popup.FilterBean;
import com.rcw.popup.LabelGridLayout;
import com.rcw.popup.SingleFilterBean;
import com.rcw.popup.TypeLabelGridLayout;

import java.util.ArrayList;
import java.util.List;

public class GridActivity extends AppCompatActivity {
    private LabelGridLayout labelGridLayout;
    private TypeLabelGridLayout typeLabelGridLayout;

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_grid);
        labelGridLayout= (LabelGridLayout) findViewById(R.id.gl_label);
        typeLabelGridLayout= (TypeLabelGridLayout) findViewById(R.id.gl_type_label);
        initFlowLabel();
        //流式布局数据
        List<FilterBean> lists=new ArrayList<>();
        List<FilterBean.TableMode> list=new ArrayList<>();
        list.add(new FilterBean.TableMode("不限"));
        list.add(new FilterBean.TableMode("已开通"));
        list.add(new FilterBean.TableMode("未开通"));
        lists.add(new FilterBean("业务状态",new FilterBean.TableMode("不限"),list));
        List<FilterBean.TableMode> list1=new ArrayList<>();
        list1.add(new FilterBean.TableMode("不限"));
        list1.add(new FilterBean.TableMode("已打印"));
        list1.add(new FilterBean.TableMode("未打印"));
        lists.add(new FilterBean("打印状态",new FilterBean.TableMode("不限"),list1));
        List<FilterBean.TableMode> list2=new ArrayList<>();
        list2.add(new FilterBean.TableMode("不限"));
        list2.add(new FilterBean.TableMode("未知"));
        list2.add(new FilterBean.TableMode("制卡中"));
        list2.add(new FilterBean.TableMode("已完成"));
        lists.add(new FilterBean("制卡状态",new FilterBean.TableMode("不限"),list2));
        List<FilterBean.TableMode> list3=new ArrayList<>();
        list3.add(new FilterBean.TableMode("不限"));
        list3.add(new FilterBean.TableMode("未知"));
        list3.add(new FilterBean.TableMode("已订购"));
        list3.add(new FilterBean.TableMode("未订购"));
        lists.add(new FilterBean("订购状态",new FilterBean.TableMode("不限"),list3));
        List<FilterBean.TableMode> list4=new ArrayList<>();
        list4.add(new FilterBean.TableMode("不限"));
        list4.add(new FilterBean.TableMode("是"));
        list4.add(new FilterBean.TableMode("否"));
        lists.add(new FilterBean("黑名单",new FilterBean.TableMode("不限"),list4));
        typeLabelGridLayout.setColumnCount(3);
        typeLabelGridLayout.setLabelBg(R.drawable.flow_popup);
        typeLabelGridLayout.setMulEnable(true);
        typeLabelGridLayout.setTitleColor(getResources().getColor(R.color.colorFont));
        typeLabelGridLayout.setGridData(lists);
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    private void initFlowLabel() {
        List<SingleFilterBean> listData=new ArrayList<>();
        List<SingleFilterBean.TableMode> list0=new ArrayList<>();
        list0.add(new SingleFilterBean.TableMode("全部"));
        list0.add(new SingleFilterBean.TableMode("超A"));
        list0.add(new SingleFilterBean.TableMode("A类"));
        list0.add(new SingleFilterBean.TableMode("B类"));
        list0.add(new SingleFilterBean.TableMode("C类"));
        list0.add(new SingleFilterBean.TableMode("D类"));
        list0.add(new SingleFilterBean.TableMode("E类"));
        listData.add(new SingleFilterBean(new SingleFilterBean.TableMode("全部"),list0));
        labelGridLayout.setColumnCount(3);
        labelGridLayout.setMulEnable(true);
        labelGridLayout.setLabelBg(R.drawable.flow_popup);
        labelGridLayout.setGridData(listData);
    }
}
